<%@ page import="java.net.URLDecoder" %><%--
  Created by IntelliJ IDEA.
  User: v
  Date: 17-3-21
  Time: 上午9:41
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Test1</title>
</head>
<body>
<%
    Cookie[] cookies=request.getCookies();
    System.out.println(cookies.length);
    String user="";
    String date="";
    if(cookies!=null){
        for(int i=0;i<cookies.length;i++){
            System.out.println(cookies[i].getName());
            if(cookies[i].getName().equals("我的世界".getBytes("UTF-8"))){
                user= URLDecoder.decode(cookies[i].getName(),"UTF-8");
                date=cookies[i].getValue();
            }
        }
    }

    if(user.equals("")&&date.equals("")){
        %>
        游客您好，欢迎您的初次光临！
        <form action="deal.jsp" method="post">
            请输入姓名<input name="user" type="text" value="">
            <input type="submit" value="确定">
        </form>
<%
    }else {
        %>
        欢迎[<b><%=user%></b>]再次光临<br/>
        您的注册时间是：<%=date%>
<%
    }
%>
</body>
</html>
